#!/usr/bin/env bash

CONFIG_PATH=$(pwd)

rm -rf $HOME/{.bashrc,.gitconfig,.pip,.latexmkrc,.aria2,.cargo/config}
rm -rf $HOME/.config/{bc,ranger,fish,mpv,zathura,ctags,kitty,starship.toml,user-dirs.dirs}

mkdir -p "$HOME/.config"

# konsole config
rm -rf $HOME/.local/share/konsole/{Profile1.profile,WhiteOnBlack.colorscheme}
mkdir -p "$HOME/.local/share/konsole"
KONSOLE_PROFILE="kde/konsole/Profile1.profile"
KONSOLE_COLOR="kde/konsole/WhiteOnBlack.colorscheme"
ln -sf $CONFIG_PATH/$KONSOLE_PROFILE "$HOME/.local/share/konsole/Profile1.profile"
ln -sf $CONFIG_PATH/$KONSOLE_COLOR   "$HOME/.local/share/konsole/WhiteOnBlack.colorscheme"

# user-dirs
install -Dm644 ./user-dirs/user-dirs.dirs $HOME/.config/user-dirs.dirs

# fontconfig
rm -rf $HOME/.config/fontconfig/fonts.conf
mkdir -p $HOME/.config/fontconfig
install -Dm644 ./fontconfig/fonts.conf $HOME/.config/fontconfig/fonts.conf

# others
ln -sf $CONFIG_PATH/pip                     "$HOME/.pip"
ln -sf $CONFIG_PATH/aria2                   "$HOME/.aria2"
ln -sf $CONFIG_PATH/bash/bashrc             "$HOME/.bashrc"
ln -sf $CONFIG_PATH/git/gitconfig           "$HOME/.gitconfig"
ln -sf $CONFIG_PATH/latex/latexmkrc         "$HOME/.latexmkrc"
ln -sf $CONFIG_PATH/bc                      "$HOME/.config/bc"
ln -sf $CONFIG_PATH/mpv                     "$HOME/.config/mpv"
ln -sf $CONFIG_PATH/fish                    "$HOME/.config/fish"
ln -sf $CONFIG_PATH/ctags                   "$HOME/.config/ctags"
ln -sf $CONFIG_PATH/kitty                   "$HOME/.config/kitty"
ln -sf $CONFIG_PATH/ranger                  "$HOME/.config/ranger"
ln -sf $CONFIG_PATH/zathura                 "$HOME/.config/zathura"
ln -sf $CONFIG_PATH/starship/starship.toml  "$HOME/.config/starship.toml"
